package com.itheima;

import java.io.File;

class Size {
    public static long Size(File directory) {

       int length = 0;
        File[] files = directory.listFiles();
        for (File file : files) {
            if (file.isFile()) {
                length += file.length();
            } else if (file.isDirectory()) {
                length += Size(file);
            }

        }
        return length;
    }

    public static void main(String[] args) {
        File directory = new File("D:/code/video");
        long size = Size(directory);
        System.out.println("文件大小: " + size);
    }
}
